<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%return_log}}".
 *
 * @property int $id
 * @property string $amount 返现金额
 * @property int $uid 用户id
 * @property int $report_id 房源id
 * @property int $buyer 买房者
 * @property int $create_at 购买时间
 * @property int  $child_id
 */
class ReturnLogModel extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%return_log}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['amount', 'uid', 'report_id', 'buyer', 'create_at'], 'required'],
            [['amount'], 'number'],
            [['uid', 'report_id', 'buyer', 'create_at','child_id'], 'integer'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'amount' => '返现金额',
            'uid' => '用户id',
            'report_id' => '报备id',
            'buyer' => '买房者',
            'create_at' => '购买时间',
        ];
    }

    public function getReport()
    {
        return $this->hasOne(ReportModel::className(), ['id' => 'report_id']);
    }
}
